/* 是否是对象 */
export const isObject = (val: unknown) => val !== null && typeof val === "object";
/* 是否是数组 */
export const isArray = Array.isArray;
/* 是否是数字 */
export const isNumber = (val: string | number): boolean => {
  if (typeof val === "number") return !isNaN(val) && isFinite(val);
  if (typeof val !== "string") return false;
  const num = parseFloat(val);
  return !isNaN(num) && isFinite(num);
};
// /* 是否是空对象 */
// export const isEmptyObject = obj => Object.keys(obj).length === 0;
// /* 是否是字符串 */
// export const isString = val => typeof val === "string";
/* 是否是函数 */
export const isFunction = (val: unknown) => typeof val === "function";
/* 对象深拷贝 */
export const deepCopy = (obj: object) => JSON.parse(JSON.stringify(obj));

/* 检查图片类型 */
export const chackImageType = (name: string) => /\/(gif|jpg|jpeg|png)$/i.test(name);
/* 检查视频类型 */
export const chackVideoType = (name: string) => /\/(mp4|avi|quicktime)$/i.test(name);
